<template "ui/head" />
<template "ui/css" />
<template tplx="local_index">
    <div class="tplx-loading" x-show="loading" style="height:187px"></div>
    <block x-if="!appshow">
        <div class="no-app">
            <p>您还未安装应用</p>
            <a class="layui-btn" href="javascript:LCMS.plugin.router(`${LCMS.url.admin}index.php?t=sys&n=appstore&c=store&a=index`)">应用商店</a>
        </div>
    </block>
    <div x-show="!loading && appshow">
        <block x-if="data.tips">
            <p class="lcms-form-des" x-html="data.tips"></p>
        </block>
        <div class="layui-form layui-input-wrap" style="margin-bottom:15px">
            <div class="layui-input-prefix">
                <i class="layui-icon layui-icon-search"></i>
            </div>
            <input type="text" placeholder="输入关键词搜索应用" class="layui-input" x-model.debounce.500ms="keyword" @input.debounce.500ms="onSearch">
        </div>
        <div class="tplx-loading-own" style="height:130px" x-show="Object.keys(data.apps).length==0">未找到相关应用</div>
    </div>
    <form x-ref="appform" x-show="!loading && appshow">
        <div class="layui-row app-local" x-ref="appbox">
            <block x-for="(app,name) in data.apps">
                <div class="li-box" x-on:mouseenter="onHover('enter',app)" x-on:mouseleave="onHover('leave',app)">
                    <input type="hidden" :name="`LC[${name}]`" value="1" />
                    <div class="li" :class="app.update?'active':''">
                        <a :href="app.url" @click.prevent="onClick('open',app)">
                            <img :src="app.icon" />
                            <h3 :title="app.title" x-text="app.title"></h3>
                            <span x-text="app.description"></span>
                        </a>
                        <block x-if="data.super">
                            <div class="layui-btn-group">
                                <block x-if="data.appstore && app.update">
                                    <a class="layui-btn layui-btn-xs layui-btn-normal" @click="onClick('update',app,name)">更新</a>
                                </block>
                                <a class="layui-btn layui-btn-xs layui-btn-warm" @click="onClick('repair',app,name)">修复</a>
                                <block x-if="app.uninstall && !data.lite">
                                    <a class="layui-btn layui-btn-xs layui-btn-danger" @click="onClick('uninstall',app,name)">卸载</a>
                                </block>
                            </div>
                        </block>
                        <block x-if="!data.super">
                            <div class="layui-btn-group">
                                <a class="layui-btn layui-btn-xs layui-btn-primary" @click="onClick('open',app)">打开</a>
                            </div>
                            </else>
                        </block>
                        <block x-if="data.power&&keyword==''">
                            <div class="move"><i class="layui-icon layui-icon-slider"></i></div>
                        </block>
                        <div class="version" x-text="`V${app.ver}`"></div>
                    </div>
                </div>
            </block>
        </div>
    </form>
</template>
<template "ui/foot" />